/**
* @Author rysa
* @Time 2021/2/27 下午2:26
* @Project go-utils
* @Desc
 */

package request

import (
	"crypto/tls"
	"github.com/go-resty/resty/v2"
)

type CertConfig struct {
	CertFile, KeyFile string
}

func NewRequest() *resty.Request {
	r := resty.New()
	return r.R()
}

/**
 * @Description: 使用密匙访问
 * @param data
 * @return *resty.Request
 */
func NewCertRequest(data CertConfig) *resty.Request {
	r := resty.New()
	cert, _ := tls.LoadX509KeyPair(data.CertFile, data.KeyFile)
	r.SetCertificates(cert)
	return r.R()

}
